
from run import *

def go3(oldRoot, localRoot, newRoot):
    import wsgiref.simple_server
    testapp = resolver.moduleRootApplication("/", root,
                                         exception_middleware=displayTraceback.__middleware__,
                                         on_not_found=None, # show traceback (could comment)
                                         )
    directoryfinder = DirectoryMergeFinder(oldRoot, localRoot, newRoot)
    testapp.registerResourceFinder(prefix="oldcontent", finder=FileContentFinder(oldRoot))
    testapp.registerResourceFinder(prefix="localcontent", finder=FileContentFinder(localRoot))
    testapp.registerResourceFinder(prefix="newcontent", finder=FileContentFinder(newRoot))
    testapp.registerResourceFinder(prefix="directory", finder=directoryfinder)
    print "start page at http://localhost:8888/mergeDirectory"
    print "serving wsgi at 8888"
    srv = wsgiref.simple_server.make_server('localhost', 8888, testapp)
    srv.serve_forever()

if __name__=="__main__":
    from sys import argv
    go3(argv[1], argv[2], argv[3])
